// 引入对应的模块
import Vue from 'vue'
import VueRouter from 'vue-router'

// 2. 注册路由模块
Vue.use(VueRouter)

import Home from '@/views/Home/Home.vue'
import Goods from '@/views/Goods/index.vue'
import Donation from '@/views/Donation/index.vue'

// import TypeNav from '../views/user/typeNav/index.vue'
import UserInfo from '@/views/UserInfo/index.vue'
import OrderList from '@/views/UserInfo/orderList/index.vue'
import UserSupport from '@/views/UserInfo/support/index.vue'
import UserInformation from '@/views/UserInfo/information/index.vue'
import AddressList from '@/views/UserInfo/addressList/index.vue'
import MyCoupon from '@/views/UserInfo/coupon/index.vue'
import AiHuiShou from '@/views/UserInfo/aihuishou/index.vue'

import Detail from '@/views/Detail/index.vue'

// 3. 设置路由信息
const router = new VueRouter({
  routes: [
    { path: '/', redirect: '/home' },
    {
      path: '/home',
      component: Home,
    },
    {
      path: '/goods',
      component: Goods,
    },
    {
      path: '/donation',
      component: Donation,
    },
    {
      name: 'user',
      path: '/user',
      component: UserInfo,
      children: [
        {
          name: 'orderList',
          path: '/orderList',
          component: OrderList,
        },
        {
          name: 'support',
          path: '/support',
          component: UserSupport,
        },
        {
          name: 'information',
          path: '/information',
          component: UserInformation,
        },
        {
          name: 'addressList',
          path: '/addressList',
          component: AddressList,
        },
        {
          name: 'coupon',
          path: '/coupon',
          component: MyCoupon,
        },
        {
          name: 'aihuishou',
          path: '/aihuishou',
          component: AiHuiShou,
        },
      ],
    },
    {
      name: 'detail',
      path: '/detail',
      component: Detail,
    },
  ],
})

// 4. 导出路由
export default router
